<?php


add_action('admin_menu', 'add_page_into_bk');
function add_page_into_bk()
{
	 add_submenu_page('payment-paypal','Bảo Kim', 'Bảo Kim', 'administrator','bao-kim','add_form_html_admin_bao_kim');
}

function add_form_html_admin_bao_kim()

{
     ?>
   <div class="wrap">
 <div><h2>Cấu Hình Thông Số Bảo Kim</h2></div>
   <?php
        if(wp_verify_nonce($_POST['action_bao_kim_config'],'bao_kim_config'))
        {
        	if(get_option('email_bk'))
        	{
        		
        		update_option('email_bk',$_POST['email_bk']);
        	}
        	else 
        	{
        		add_option('email_bk',$_POST['email_bk']);
        	}
        	
        	if(get_option('merchant_id_bk'))
        	{
        			update_option('merchant_id_bk',$_POST['merchant_id_bk']);
        	}
        	else 
        	{
        		add_option('merchant_id_bk',$_POST['merchant_id_bk']);
        	}
        	
        if(get_option('secure_pass_bk'))
        	{
        			update_option('secure_pass_bk',$_POST['secure_pass_bk']);
        	}
        	else 
        	{
        		add_option('secure_pass_bk',$_POST['secure_pass_bk']);
        	}
        
        if(get_option('status_bk'))
        	{
        			update_option('status_bk',$_POST['status_bk']);
        	}
        	else 
        	{
        		add_option('status_bk',$_POST['status_bk']);
        	}
        	add_option('status_bk',$_POST['status_bk']);
        	echo '<h2>Saved Successful!</h2>';
        }
   
   ?>


<fieldset style="border:1px solid #ddd;">
<legend >Cấu Hình Chung</legend>
 <form action="" method="post">
      <table style="padding:10px;">
         <tr>
         <td>Trạng Thái:</td>
         <td><select name="status_bk">
		  <option value="yes">Chạy</option>
		  <option value="no">Test</option>
            </select> 
            
            </td>
         </tr>
         <tr>
         <td>Email Nhận Tiền:</td>
         <td><input type="text" style="width:130%;" name="email_bk" value="<?php echo get_option('email_bk');?>"/></td>
         </tr>
         <tr>
         <td>Merchant site code:</td>
         <td><input type="text" style="width:130%;" name="merchant_id_bk" value="<?php echo get_option('merchant_id_bk');?>"/></td>
         </tr>
         <tr>
         <td>Secure pass:</td>
         <td><input type="text" style="width:130%;" name="secure_pass_bk" value="<?php echo get_option('secure_pass_bk');?>"/></td>
         </tr>
         <tr>
		 <td></td>
		 <td><input class="button-primary" type="submit" name="submit" value="Save"/></td>
		 </tr>
		
		</table>    
		 <?php wp_nonce_field('bao_kim_config','action_bao_kim_config')?>
		   </form>

</fieldset>


</div>
     <?php 
}